import request from '@/common/request/request.js'
import config from '@/common/config/config.js';
import { data } from 'uview-ui/libs/mixin/mixin';
const http = config.env

// 商品分类
export const productCate = (data) => {
	return request({
		url: http.baseUrl + '/product/cate',
		method: 'GET',
		data: data
	})
}
// 商品分区
export const productArea = (data) => {
	return request({
		url: http.baseUrl + '/product/area',
		method: 'GET',
		data: data
	})
}

// 商品列表
export const productList = data => {
	return request({
		url: http.baseUrl + '/product/list',
		method: 'GET',
		data: data
	})
}

// 商品详情
export const productDetail = (productId) => {
	return request({
		url: http.baseUrl + '/product/detail/' + productId,
		method: 'GET',
	})
}

// banner列表
export const bannerList = () => {
	return request({
		url: http.baseUrl + '/common/banner',
		method: 'GET',
	})
}

// 获取生鲜保障
export const getSafeguard = productId => {
	return request({
		url: http.baseUrl + `/product/safeguard/${productId}`,
		method: 'GET',
	})
}


// 加入购物车
export const addGoodsToCart = data => {
	return request({
		url: http.baseUrl + `/shopCart/addCart`+data,
		method: 'post',
	})
}

// 创建订单
export const createOrder = data => {
	return request({
		url: http.baseUrl + `/order/create`,
		method: 'post',
		data
	})
}

// 获取商品分类
export const getProductCate = () => {
	return request({
		url: http.baseUrl + `/product/cate`,
		method: 'get'
	})
}

// 获取商品列表
export const getProductList = (data) => {
	return request({
		url: http.baseUrl + `/product/list`,
		method: 'get',
		data
	})
}



